package com.yvdelx.cyclowomen.activity.adapter;

import android.app.Activity;

import com.jjoe64.graphview.CustomLabelFormatter;
import com.yvdelx.R;

import static com.yvdelx.cyclowomen.utility.StringUtility.formatDouble;

/**
 * Format labels of the graphic activity
 */
public class GraphLabelFormatterAdapter implements CustomLabelFormatter {

    private Activity activity;

    public GraphLabelFormatterAdapter(Activity activity){
        this.activity = activity;
    }

    @Override
    public String formatLabel(double value, boolean isValueX) {
        if(isValueX){
            return "";
        }

        return formatDouble(value)
                + " "
                + this.activity.getResources().getString(R.string.degree);
    }
}
